package com.explorati.design_pattern.structural.proxy.example2.cglibproxy;

import com.explorati.design_pattern.structural.proxy.example2.GamePlayer;
import com.explorati.design_pattern.structural.proxy.example2.IGamePlayer;

import net.sf.cglib.proxy.Enhancer;

public class Test {

	public static void main(String[] args) {
		// IGamePlayer proxy = (IGamePlayer) new GamePlayerCglibProxy(new
		// GamePlayer("李逍遥")).getProxy();
		// proxy.killBoss();
		// proxy.upGrade();
		IGamePlayer GamePlayer = new GamePlayer("李逍遥");
		GamePlayerCglibProxy proxy = new GamePlayerCglibProxy(GamePlayer);

		
		Enhancer e = new Enhancer();
		e.setSuperclass(GamePlayer.getClass());
		e.setCallback(proxy);

		IGamePlayer o = (IGamePlayer) e.create();
		o.killBoss();
		o.upGrade();
	}
}
